<template>
  <div class="app-container">
    <el-form
      ref="onlieForm"
      :model="onlieForm"
      :rules="rules"
      label-width="80px">
      <el-row :gutter="20">
        <el-col :span="24">
          <el-form-item
            label="号码"
            prop="phone">
            <el-input
              placeholder="请输入号码"
              v-model="onlieForm.phone"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
  import { onlineTimeSend } from '@/api/product';
  export default {
    name: 'onlineTransfer',
    props: {
      productNo: {
        type: [String, Number],
        default: '',
      },
    },
    data() {
      return {
        onlieForm: {
          phone: '',
        },
        rules: {
          phone: { required: true, trigger: 'blur', message: '请填写号码' },
        },
      };
    },
    methods: {
      handleSubmit() {
        this.$refs.onlieForm.validate(valid => {
          if (valid) {
            let params = { ...this.onlieForm };
            params['product_no'] = this.productNo;
            this.$emit('update:loadingButton', ['submit']);
            onlineTimeSend(params).then(res => {
              this.$message.success(res.message);
              this.$emit('update:visible', false);
            }).finally(()=>{
              this.$emit('update:loadingButton', []);
            });
          }
        });
      },
    },
  };
</script>
